#ifndef VIDEOFRAME_H
#define VIDEOFRAME_H


#include<memory>
#include<cstdint>


struct AVFrame;


class VideoFrame
{
public:
    explicit VideoFrame(AVFrame* frame=nullptr,int64_t ptsMs=0);
    ~VideoFrame();

     // 禁止拷贝（避免 AVFrame 双重释放）
    VideoFrame(const VideoFrame&) = delete;
    VideoFrame& operator=(const VideoFrame&) = delete;

     // 支持移动语义（高效传递所有权）
    VideoFrame(VideoFrame&& other) noexcept;
    VideoFrame& operator=(VideoFrame&& other) noexcept;


    //判断视频帧是否有效
    bool isValid() const;

    //获取原始 AVFrame指针

    AVFrame* getRawFrame() const;

    //获取视频帧宽度

    int getWidth() const;

    //获取视频帧高度
    int getHeight() const;

    //获取像素格式
    int getPixelFormat() const;

    //获取/设置时间戳
    int64_t getPtsMs() const;
    void setPtsMs(int64_t ptsMs);

    //获取视频数据指针数组
    uint8_t**getData()const;

    //获取每行数据字节数
    int*getLinesize()const;

    //释放当前帧
    void release();


private:
    AVFrame* m_frame;
    int64_t m_ptsMs;

};

#endif
